using UnityEngine;

public class MapViewSunMoon : MonoBehaviour
{
	private Transform eye;

	private float blinkTimer;

	private bool isBlink;

	private Transform light;

	private float angle;

	private void Start()
	{
		eye = base.transform.Find("Eye");
		blinkTimer = Random.Range(3, 5);
		light = base.transform.Find("Light");
	}

	private void Update()
	{
		if (eye != null && isBlink)
		{
			blinkTimer += Time.deltaTime * 5f;
			if (blinkTimer <= 0.5f)
			{
				eye.localScale = new Vector3(1f, 1f - blinkTimer / 0.5f * 0.9f, 1f);
			}
			else if (blinkTimer <= 1f)
			{
				eye.localScale = new Vector3(1f, 0.1f + (blinkTimer - 0.5f) / 0.5f * 0.9f, 1f);
			}
			else
			{
				eye.localScale = new Vector3(1f, 1f, 1f);
				isBlink = false;
				blinkTimer = Random.Range(3, 5);
			}
		}
		else
		{
			blinkTimer -= Time.deltaTime;
			if (blinkTimer <= 0f)
			{
				isBlink = true;
			}
		}
		if (light != null)
		{
			angle -= Time.deltaTime * 10f;
			light.eulerAngles = new Vector3(0f, 0f, angle);
		}
	}
}
